//2009/08/26 02:12:53
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class MixtureDensity
{
public:
    double getDensity(vector <string> ingredients)
    {
		double total = 0.0;
		double sub = 0.0;
		for(int i=0; i<ingredients.size(); i++)
		{
			stringstream ss(ingredients[i].substr(0, ingredients[i].size() -2));
			string s;
			int a, b;
			ss >> a ;
			while(ss >> s);
			stringstream temp(s);
			temp >> b;
			//<Volume> ml of <Name>, weighing <Mass> g
			cout << "a:" << a << ", b: " << b << endl;
			total += 1.0 * a;
			sub += 1.0 * b;
		}
		return sub / total;
    }
};
